]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
UnlockDialog: honor org.gnome.desktop.screensaver.user-switch-enabled
authorGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 3 Jan 2013 00:02:13 +0000 (01:02 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 3 Jan 2013 00:43:27 +0000 (01:43 +0100)
The screensaver schema has a key that it is meant for locking down
the ability to switch user when the screen is locked, but support
for it was not implemented in the new screenshield.
Fix that by checking the key before creating the button.

https://bugzilla.gnome.org/show_bug.cgi?id=691042

js/ui/unlockDialog.js

index 794f6cd83c2ea07e7df0edb61442c2374634e046..6b6127bbceba661c2c56b764fea2b3faf87f36d3 100644 (file)
@@ -198,18 +198,23 @@ const UnlockDialog = new Lang.Class({
                                           x_align: St.Align.END,
                                           y_align: St.Align.MIDDLE });
 
-        let otherUserLabel = new St.Label({ text: _("Log in as another user"),
-                                            style_class: 'login-dialog-not-listed-label' });
-        this._otherUserButton = new St.Button({ style_class: 'login-dialog-not-listed-button',
-                                                can_focus: true,
-                                                child: otherUserLabel,
-                                                reactive: true,
-                                                x_align: St.Align.START,
-                                                x_fill: true });
-        this._otherUserButton.connect('clicked', Lang.bind(this, this._otherUserClicked));
-        this.dialogLayout.add(this._otherUserButton,
-                              { x_align: St.Align.START,
-                                x_fill: false });
+        let screenSaverSettings = new Gio.Settings({ schema: 'org.gnome.desktop.screensaver' });
+        if (screenSaverSettings.get_boolean('user-switch-enabled')) {
+            let otherUserLabel = new St.Label({ text: _("Log in as another user"),
+                                                style_class: 'login-dialog-not-listed-label' });
+            this._otherUserButton = new St.Button({ style_class: 'login-dialog-not-listed-button',
+                                                    can_focus: true,
+                                                    child: otherUserLabel,
+                                                    reactive: true,
+                                                    x_align: St.Align.START,
+                                                    x_fill: true });
+            this._otherUserButton.connect('clicked', Lang.bind(this, this._otherUserClicked));
+            this.dialogLayout.add(this._otherUserButton,
+                                  { x_align: St.Align.START,
+                                    x_fill: false });
+        } else {
+            this._otherUserButton = null;
+        }
 
         this._updateSensitivity(true);
 
@@ -231,8 +236,10 @@ const UnlockDialog = new Lang.Class({
         this._promptEntry.reactive = sensitive;
         this._promptEntry.clutter_text.editable = sensitive;
         this._updateOkButtonSensitivity(sensitive && this._promptEntry.text.length > 0);
-        this._otherUserButton.reactive = sensitive;
-        this._otherUserButton.can_focus = sensitive;
+        if (this._otherUserButton) {
+            this._otherUserButton.reactive = sensitive;
+            this._otherUserButton.can_focus = sensitive;
+        }
     },
 
     _updateOkButtonSensitivity: function(sensitive) {